package com.eso.haBank.domain

import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString

@EqualsAndHashCode
@ToString(includeNames = true, includeFields = false, excludes = 'metaClass,beforeInsert,beforeUpdate')
class DataStamp implements Serializable{

    long id;
    String dataStamp;
    Integer dataStatus;

    String comment;

    Date createTime;
    Date updateTime;

    static constraints = {
        dataStamp(maxSize: 10, unique: true)
        dataStatus(inList: [0, 1, 2])

        comment(nullable: true, maxSize: 500)

        createTime(nullable: true)
        updateTime(nullable: true)
    }

    def beforeInsert = {
        createTime = new Date()
        updateTime = new Date()
    }

    def beforeUpdate = {
        updateTime = new Date()
    }

    static mapping = {
        table 'sys_data_stamp'
        version false
    }
}
